home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Add-Ons
/
After Dark
/
The Swarm 1.5
/
The Swarm README
< prev
Wrap
Text File
|
1995-12-05
|
13KB
|
272 lines
_______________________________________________________________
THE SWARM 1.5 — A freeware Screensaver Module
By Leo Breebaart, Copyright ©1994-95 Kronto Software
Internet e-mail: leo@cp.tn.tudelft.nl
Internet WWW page: http://www.cp.tn.tudelft.nl/leo/kronto.html
_______________________________________________________________
Description
The Swarm is a simple, but surprisingly elegant and mesmerizing
line animation, in which a number of small line segments (the ‘bees’)
chase one other segment (the ‘queen bee’) across the screen.
Features
• Compatible with After Dark (both 2.0 and 3.0), DarkSide of the Mac and UnderWare.
• Flicker-free animation with smooth fade-out/fade-in effects.
• Intelligent Demo Mode (as if anybody cares :—) ).
• Does not use any permanent System memory under After Dark 2.0.
• Has an animated About Box and thumbnail.
• Runs under both MultiModule and the Randomizer — without crashing.
• Comes with extensively documented source code (CodeWarrior 7 C format).
• Both the module and the source code are free.
Restrictions & Technical Remarks
• The Swarm needs Color QuickDraw to run. A color screen is not essential,
however: on a Black & White SE/30 the module works just fine.
• Multiple-monitor setups are supported, but not actively used — the animation
always runs on the main monitor only (and will simply black out any other screens).
• I cannot guarantee that The Swarm will work with versions of After Dark
earlier than 2.0u. The same holds for any other programs that are supposed
to be able to play After Dark modules (except for DarkSide and UnderWare,
which I had access to). In all such cases, The Swarm may run, or it may not.
Feedback about compatibility issues will be much appreciated.
• At the moment of writing the latest version numbers of the screensavers
The Swarm has been tested to work with are 3.0b for After Dark, 4.2 for DarkSide
and 1.0.1 for UnderWare. Free updaters for these programs are readily available
on the Internet and on all the major commercial software archives. See also the
URL appendix at the end of this document.
Who thought of it first
I first came across this animation in an X Windows program called xswarm,
written by Jeff Butterworth in the early 90s. I liked it so much that I
decided to write an After Dark version. Most of the module I had to create
from scratch, but the core algorithm was taken straight from Jeff’s
sources. My module, of course, lacks all the many options that his X Windows
program has. If you have access to an appropriate machine, be sure to
check out xswarm — it’s great.
Shortly after I began programming this module it was brought to my
attention that there already was a ‘swarm’ After Dark module, called
ColorSwarm!, written by Dan Walkowski in 1991.
Since his module looked a bit different from what I had in mind, I just went
ahead and wrote my own version anyway. But be sure to check out his module.
He has more parameters for you to set, his ColorSwarm! works on B&W
machines without Color QuickDraw, and I believe he also makes use of multiple
monitors, which I don’t.
Version history
1.0 25 Mar 1994
— Initial release.
1.1 24 Feb 1995
— Bees on 256-color screens will now change color as they move along. Added
a new slider to control the color-changing speed.
— Had to sacrifice the 'smooth fade' checkbox to make room for the new slider.
The Swarm now always fades smoothly, if possible.
— The About Box now wil take advantage of After Dark 3.0’s expanded
about box area (provided you’re running 3.0, of course. Duh.).
— Added animated thumbnail for After Dark 3.0.
— Cleaned up the source code.
1.1.1 19 May 1995
— Fixed a bug that caused crashes for people running the module on a Mac IIsi
under DarkSide.
— Shortened the duration of the fade-out when the module kicks in, and entirely
removed the fade-in when the module ends. Having to wait so long for the
fade effects to take place got on people’s nerves (including mine).
— Removed all references to the After Dark FTP Site and the Programmers’ List,
because both are now (temporarily) defunct.
1.5 5 December 1995
— The Swarm is now a FAT module that will run native on PowerMacs, provided
you are using After Dark 3.0 or later.
— Code ported to CodeWarrior.
— Many internal improvements to the code and the project structure. The module
should now react much more gracefully to error conditions.
Credits & Acknowledgments
First of all, my thanks to Jeff Butterworth for giving me permission to ransack
his code and port his algorithm to the Mac.
Frits Kuijlman did the initial port of the code from THINK C to CodeWarrior, and helped me
figure out how to get the module to run native on a PowerMac.
Neither Frits nor I would have had much success, however, if Robert Geisler had not shown
us the way. Without his Fat Module code this version of The Swarm would not have happened.
For technical assistance, emotional support and beta-testing I owe a sincere
thank-you to Rodney “Jewelbox” Jacks, to Lloyd “Screensaver FAQ” Wood, and to
all the members of the After Dark programmers mailing list.
Without Timo Eloranta’s error reports and his willingness to crash his Mac for me I
would never have been able to track down the IIsi-killing bug in version 1.1.
Special thanks to Jonas Englund, for allowing me to use, adapt and distribute
his CLUT fading code.
Extra special thanks to David “Bat Signal” Zwiefelhofer, to Joseph
“Peek-a-Boo” Judge, and to Berkeley Systems themselves for releasing sample
source code and documentation without which this module would never have
been written in the first place.
The Swarm was created using CodeWarrior 7, Think Reference 2.0.1,
ResEdit 2.1.3, BBEdit 3.5.1, and Adobe Photoshop 3.0.1.
Known Problems
• The color-changing bees was the single most-requested feature for
The Swarm, so I added it. However, the current implementation is just
a quick interim hack to make it work for at least some of the people. In
particular: the bees will only change color on displays in 8-bit (256 color)
mode, never in modes with a higher or lower number of colors. Fixing this
will be one of the top priorities for the next version of The Swarm.
• The color-changing slider has no effect in demo-mode.
• Under certain very rare circumstances (specifically: if you have a
multi-monitor setup in which your main monitor (the one with the menu
bar) is not placed in the ‘left-upper-most’ position in the Monitors control
panel) the module will start drawing garbage on your screen when
activated. This is an entirely cosmetic bug, and I know precisely what’s
causing it — I just don’t know how to fix it, yet.
• Under certain other not-so-rare circumstances (specifically: if After
Dark starts displaying a “Please Wake Up” message while the module
is running, e.g. when a background application wants your attention) the
module will also start drawing garbage to your screen. This too, is an entirely
cosmetic bug — but I’l be darned if I know what’s causing it, or how to
fix it.
• The Swarm can cause crashes on the Macintosh IIsi, which may or may
not be related to problems with a special kind of video card.
• Those of you interested in the source code should be aware (you may
have already gathered it from the above few paragraphs :-) ) that I am
not an experienced Macintosh programmer — in fact, The Swarm was my
very first programming effort for the Mac. This means that the code
may have hidden problems that I’m simply not aware of. Don’t assume
that I’m always doing things the ‘right’ way.
I would appreciate hearing about any other bugs or problems you may encounter
with The Swarm.
A Word about Memory and CPU-time
The Swarm tries to be a well-behaved, system-friendly module. It will, for
instance, not reserve any permanent memory in your system heap. That
means that having The Swarm selected costs you no more memory than having
the default ‘Starry Night’ module selected, as long as After Dark has not
taken over the screen.
Of course, once After Dark kicks in, The Swarm does need loads of memory
for its animation (the larger your screen the worse it gets), which it
will try to allocate out of the free memory you have at that moment. In
low-memory situations (e.g. if you have lots of applications open), this
attempt may be unsuccessful, and the module will refuse to run with an
appropriate error message. The reason I am explaining all of this in such
detail is that the upshot of this strategy is that you may see The Swarm
‘fail’ to run more often than other modules. But that is entirely
intentional, and only means that it is your real applications which are
getting access to every last Kb of your available memory. Isn’t that how
things should be?
On fast Macs (Quadra’s or higher), finally, you will want to use the ‘Swarm
Speed’ slider in the control panel to slow the animation down. Here too, I
just want to point out that if you do this, then the extra CPU time will be
given back to the system. The Swarm will never use more processing power
then it really needs.
Still To Do
Version 1.5 is still just a minor upgrade to version 1.0. There will be a major new
version of The Swarm, although for the coming months (I’m writing this in
December 1995) I won’t have time to work on it, sorry. For The Swarm 2.0
I intend the following features and fixes:
• Allow color-changing bees on non-CLUT devices (i.e. non-8-bit modes)
• Add more parameters for you to play with.
• Make Queen Bee behave more intelligently and interestingly.
• Multiple Swarms, or maybe multiple Queen Bees (there’s a difference!).
• Add sound/music.
• Add an option to make the entire Swarm move 3-dimensionally, with
depth indicated by perspective projection and color brightness.
• Support old, non-Color Quickdraw B&W Macs.
If you have any suggestions to add to this list, let me know.
For Programmers
The most recent version of the After Dark programmer’s interface (which
also gets updated every now and then — the copy you have may
be outdated!) is available from the major Internet archive sites such
as sumex.stanford.edu, mac.archive.umich.edu and their mirrors.
The best place to browse if you want to program After Dark modules,
though, is the Photon Farmer’s FTP site (or their Web pages). You will find
all kinds of After Dark modules and resources there, and these guys also
maintain the After Dark Programmer’s mailing list (archives accessible!)
Finally, you may also want to take a look at ScreenFlip, another screensaver
module I wrote, which also comes with documented source code.
Final Remark
Nobody who owns a Macintosh screensaver package should be without
the most recent version of Lloyd Wood’s Screensaver FAQ (Frequently
Asked Questions) List. Copies of this list are also available from all major
archive sites on or off the Internet. It is a must-have.
Enjoy,
__
Leo Breebaart (leo@cp.tn.tudelft.nl)
_______________________________________________________________
Appendix: URLs
Here are URLs for some of the Internet resources mentioned in this document.
Newer versions of these files may of course have been released by the time
you read this. Most of the files are available from many other sites as well.
Kronto Software WWW/ftp sites (for info about me and my other programs):
http://www.cp.tn.tudelft.nl/leo/kronto.html
ftp://kronto.cp.tn.tudelft.nl/pub/macintosh/
Photon Farmers After Dark Mailing list and FTP Site
http://www.phofarm.com/
ftp://ftp.phofarm.com/pub/screensavers/mac/afterdark/
Robert Geisler's Fat Module example code
ftp://ftp.phofarm.com/pub/screensavers/mac/afterdark/Fat_Module_Source.sit.hqx
DarkSide of the Mac 4.2:
ftp://ftp.apple.com/dts/mac/hacks/darkside-of-the-mac-4-2.hqx
Macintosh FAQs WWW/ftp sites:
http://www.astro.nwu.edu/lentz/mac/faqs/home-faqs.html
http://www.ee.surrey.ac.uk/Personal/L.Wood/screensavers/
ftp://rtfm.mit.edu/pub/usenet/news.answers/macintosh/
Original X-Windows xswarm program:
ftp://ftp.x.org/R5contrib/xswarm.2.3.tar.Z
_______________________________________________________________